#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int N;
    scanf("%d", &N);
    int a[50];
    for (int i = 0; i < N; i++)
    {
        scanf("%d ", &a[i]);
    }
    int X;
    scanf("%d", &X);
    int j = 0;
    for (int i = 0; i < N; i++)
    {
        if (a[i] != X)
            a[j++] = a[i];
    }
    for (int i = 0; i < j; i++)
    {
        printf("%d ", a[i]);
    }
}